#ifndef MYTREEITEMDELEGATE_H
#define MYTREEITEMDELEGATE_H

#include <QStyledItemDelegate>
#include <QPainter>
class MyTreeItemDelegate : public QStyledItemDelegate
{
public:
    explicit MyTreeItemDelegate(int iconTextSpacing = 10, QObject *parent = nullptr);
    //设置字体颜色
    void setTextColor(QColor color);
    void addItem(long long nIndex, QString, QString);
signals:
private:
    void  paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
    void  drawArrow(QPainter *painter, const QRect &rect, bool expanded) const;
    QColor m_textColr;
    QColor m_backgroundColr;
    QMap<long long, QVector<QString>> m_IconMap;
    int m_nVsapcing; //行间距
    QObject*            m_parentObject;
};

#endif // MYTREEITEMDELEGATE_H
